home *** CD-ROM | disk | FTP | other *** search
/ CD Exchange / CD Exchange - Volume 1.iso / graphics / utils / videotracker / develop / source / wave.s < prev   
Text File  |  1993-08-09  |  44KB  |  2,083 lines

  1. rout            ;when this is off, the routine-file will be
  2.             ;assembled, on=testing
  3.             
  4. ;debug            ;when this is on, colors in the background will
  5.             ;show how much time the routine needs.
  6.  
  7.  
  8. routinemode    equ    19    ;the routinemode !
  9.  
  10.  
  11. ; the first part of the source handles the things that are necessary to
  12. ; show the picture/copper and playing of the routine.
  13. ; the part between the "***" lines is the routine-source.
  14. ; at the bottom of the file, there are the necessary incbin-files who
  15. ; are needed to test the routine.
  16. ; these are saved with "save effect" in videotracker. they are raw
  17. ; data files which can be fonts,pictures,landscapes,vectorobjects
  18. ; etcetra.
  19. ; the incbin-files are put in the "variables" table, in the routine-
  20. ; player-handler
  21. ; the place where it's done can be found by searching for "!!!"
  22.  
  23.  
  24.     opt    a+    ;devpac 3 optimize
  25.     opt    o+
  26.  
  27.     ifd    rout
  28.     
  29.     ;videotracker routine-test
  30.  
  31.     incdir    "videotracker:include/"
  32.     include    "exec/types.i"
  33.     include    "graphics/gfxbase.i"
  34.     include    "lvo/graphics_lib.i"
  35.     incdir    'videotracker:effect/'
  36.  
  37. vew_wid    equ    44
  38. vew_hgt    equ    290
  39. win_hgt    equ    117
  40. win_str    equ    $1a
  41.  
  42.     SECTION    1,CODE_C
  43. tus
  44.  
  45.     lea    var,a0            ;communication-table
  46. ;    move.l    #rotinc,var_cols1(a0)    ;incbinfile !!!
  47.  
  48.     move.l    ($4).w,a6
  49.     sub.l    a1,a1
  50.     jsr    -$126(a6)        ;findtask
  51.     move.l    d0,curtsk
  52.     move.l    d0,a0
  53.     move.l    $b8(a0),tskpri
  54.  
  55.     lea    dosnam,a1        ;doslib openen
  56.     moveq.l    #0,d0
  57.     move.l    (4).w,a6
  58.     jsr    -408(a6)        ;openlib
  59.     move.l    d0,doslib
  60.  
  61.     bsr.s    label5            ;videotracker opstarten
  62.     
  63.     move.l    curtsk,a0
  64.     move.l    tskpri,$b8(a0)
  65.     move.l    ($4).w,a6
  66.     jsr    -$84(a6)        ;forbid
  67.  
  68.     move.l    doslib,a1
  69.     move.l    (4).w,a6
  70.     jsr    -414(a6)        ;closelib
  71.  
  72.     moveq.l    #0,d0
  73.     rts
  74.     
  75. label5
  76.     move.l    (4).w,a6        ;workbench gedoe
  77.     move.b    530(a6),ntscmode    ;50/60 hertz halen
  78.  
  79.     cmp.b    #50,ntscmode        ;ntsc ?
  80.     beq.s    str.ntsc
  81.     move.l    #vew_hgt-56,hogscr    ;set NTSC screen hight
  82. str.ntsc
  83.  
  84.     move.l    (4).w,a6        ;68030 cache off 
  85.     jsr    -120(a6)
  86.  
  87.     btst.b    #1,297(a6)
  88.     beq.s    str.nfc
  89.     lea.l    str.ft,a5
  90.     jsr    -30(a6)
  91. str.nfc
  92.     jsr    -126(a6)
  93.     bra.s    str.fc
  94.     
  95. str.ft
  96.     dc.w    $4e7a,2
  97.     bclr    #0,d0
  98.     bset    #13,d0
  99.     dc.w    $4e7b,2
  100.     rte
  101. str.fc
  102.  
  103.     lea    cprjmp,a2        ;copjmp zetten !
  104.     move.l    #cprbck-8,d0
  105.     move.w    d0,6(a2)
  106.     swap    d0
  107.     move.w    d0,2(a2)
  108.  
  109.     lea    cprbck-8,a2        ;copstr zetten !
  110.     move.l    #cpr,d0
  111.     move.w    d0,6(a2)
  112.     swap    d0
  113.     move.w    d0,2(a2)
  114.  
  115.     bsr    cprsprrem        ;sprites legen
  116.  
  117.     lea    gfxnam,a1        ;graphics lib openen
  118.     move.l    (4).w,a6
  119.     jsr    -408(a6)        ;openlib
  120.     move.l    d0,a6
  121.     move.l    d0,gfxlib
  122.     move.l    38(a6),oldcprlist
  123.  
  124.     bset    #1,$bfe001
  125.     bsr    copbuf            ;copper vullen
  126.  
  127.     bsr    sysoff
  128.  
  129. gadrun
  130.     btst    #6,($bfe001).l
  131.     bne    gadrun
  132.  
  133. scrend
  134. scrend.play
  135.     bsr    syson
  136.  
  137.     move.l    gfxlib,a1
  138.     move.l    (4).w,a6
  139.     jsr    -414(a6)        ;closelib
  140.  
  141. scrend.qb
  142.     moveq.l    #0,d0    
  143.     rts
  144.     
  145.     ;vertical blank interrupt, no blits.
  146.     ;handles counters,interlace,sprite
  147.     ;level 3
  148.  
  149. intvb
  150.     bra.s    intvb.cnt
  151.     dc.l    'VIDU'
  152.     dc.l    'LOOP'
  153. intvb.cnt
  154.     movem.l    d0-d7/a0-a6,-(sp)
  155.     lea    ($dff000).l,a6
  156.  
  157.     move.w    $01e(a6),d0
  158.     btst    #5,d0            ;vblank ?
  159.     bne.s    intvb.vb
  160.  
  161.     bra.s    intcop.end
  162.  
  163. intvb.vb
  164.     bsr    grap
  165.     bsr    palctr            ;palette zetten
  166.     bsr.s    copbuf            ;copper vullen
  167.     
  168. intvb.end
  169.     move.w    #$0020,$09c(a6)    ;vb bit wissen
  170.     movem.l    (sp)+,d0-d7/a0-a6    ;multitask uit, shit !
  171.     rte
  172.  
  173. intcop.end
  174.     movem.l    (sp)+,d0-d7/a0-a6
  175.     move.l    intvbold,-(sp)
  176.     rts
  177.  
  178.     ;transmission buffer empty routine, BLIT !
  179.     ;handles routines,animations
  180.     
  181. inttbe                    ;tbe interrupt
  182.     movem.l    d0-d7/a0-a6,-(sp)
  183.     lea    ($dff000).l,a6
  184.  
  185.     move.w    $01e(a6),d0
  186.     btst    #0,d0            ;no tbe ?
  187.     beq.s    intdskblk
  188.  
  189.  
  190.     btst    #6,($bfe001).l        ;muis ingedrukt ?
  191.     beq.s    inttbe.cop
  192.     btst    #2,($dff016).l
  193.     beq.s    inttbe.cop
  194.  
  195.     ifd    debug
  196.     move.w    #$700,$dff180
  197.     endc
  198.     
  199.     bsr    rotply            ;routineplayer BLIT !
  200.     bsr.s    copbuf            ;copper vullen
  201.  
  202.     ifd    debug
  203.     move.w    #$070,$dff180
  204.     endc
  205.     
  206. inttbe.cop
  207.  
  208. inttbe.end
  209.     move.w    #$0001,$09c(a6)
  210.     movem.l    (sp)+,d0-d7/a0-a6
  211.     rte
  212.  
  213. intdskblk
  214.     move.w    #$0001,$09c(a6)        ;be sure for no tbe handling
  215.     movem.l    (sp)+,d0-d7/a0-a6
  216.     move.l    inttbeold,-(sp)
  217.     rts
  218.  
  219.  
  220.     ;moves the copperbuffer to the copperlist
  221.     ;sort of double buffering
  222.     
  223. copbuf
  224.     movem.l    d0-d7/a0-a6,-(sp)
  225.  
  226.     lea    ($dff000).l,a6
  227.  
  228. copbuf.novb                ;copperchange overslaan
  229.     moveq.l    #0,d0
  230.     move.b    $005(a6),d0
  231.     lsl.w    #8,d0
  232.     moveq.l    #0,d1
  233.     move.b    $006(a6),d1
  234.     add.w    d1,d0
  235.  
  236.     cmp.w    #$4,d0
  237.     blt    copbuf.novb
  238.  
  239.     cmp.b    #50,ntscmode
  240.     beq.s    copbuf.pal
  241.     cmp.w    #$133-56-8,d0        ;ntsc grens
  242.     bge    copbuf.novb
  243.     bra.s    copbuf.cont
  244. copbuf.pal
  245.     cmp.w    #$133-8,d0        ;pal grens
  246.     bge    copbuf.novb
  247. copbuf.cont
  248.  
  249.     lea    gra.s,a0        ;buffer copieren
  250.     lea    cprbuf,a1
  251.  
  252.     move.w    00*4+2(a0),00*4+2(a1)
  253.     move.w    01*4+2(a0),01*4+2(a1)
  254.     move.w    02*4+2(a0),02*4+2(a1)
  255.     move.w    03*4+2(a0),03*4+2(a1)
  256.     move.w    04*4+2(a0),04*4+2(a1)
  257.     move.w    05*4+2(a0),05*4+2(a1)
  258.     move.w    06*4+2(a0),06*4+2(a1)
  259.     move.w    07*4+2(a0),07*4+2(a1)
  260.     move.w    08*4+2(a0),08*4+2(a1)
  261.     move.w    09*4+2(a0),09*4+2(a1)
  262.  
  263.     move.w    10*4+2(a0),10*4+2(a1)
  264.     move.w    11*4+2(a0),11*4+2(a1)
  265.     move.w    12*4+2(a0),12*4+2(a1)
  266.     move.w    13*4+2(a0),13*4+2(a1)
  267.     move.w    14*4+2(a0),14*4+2(a1)
  268.     move.w    15*4+2(a0),15*4+2(a1)
  269.     move.w    16*4+2(a0),16*4+2(a1)
  270.     move.w    17*4+2(a0),17*4+2(a1)
  271.     move.w    18*4+2(a0),18*4+2(a1)
  272.     move.w    19*4+2(a0),19*4+2(a1)
  273.  
  274.     move.w    20*4+2(a0),20*4+2(a1)
  275.     move.w    21*4+2(a0),21*4+2(a1)
  276.     move.w    22*4+2(a0),22*4+2(a1)
  277.     move.w    23*4+2(a0),23*4+2(a1)
  278.     move.w    24*4+2(a0),24*4+2(a1)
  279.     move.w    25*4+2(a0),25*4+2(a1)
  280.     move.w    26*4+2(a0),26*4+2(a1)
  281.     move.w    27*4+2(a0),27*4+2(a1)
  282.     move.w    28*4+2(a0),28*4+2(a1)
  283.     move.w    29*4+2(a0),29*4+2(a1)
  284.  
  285.     move.w    30*4+2(a0),30*4+2(a1)
  286.     move.w    31*4+2(a0),31*4+2(a1)
  287.     move.w    32*4+2(a0),32*4+2(a1)
  288.     move.w    33*4+2(a0),33*4+2(a1)
  289.     move.w    34*4+2(a0),34*4+2(a1)
  290.     move.w    35*4+2(a0),35*4+2(a1)
  291.     move.w    36*4+2(a0),36*4+2(a1)
  292.     move.w    37*4+2(a0),37*4+2(a1)
  293.     move.w    38*4+2(a0),38*4+2(a1)
  294.     move.w    39*4+2(a0),39*4+2(a1)
  295.  
  296.     move.w    40*4+2(a0),40*4+2(a1)
  297.     move.w    41*4+2(a0),41*4+2(a1)
  298.     move.w    42*4+2(a0),42*4+2(a1)
  299.     move.w    43*4+2(a0),43*4+2(a1)
  300.     move.w    44*4+2(a0),44*4+2(a1)
  301.     move.w    45*4+2(a0),45*4+2(a1)
  302.     move.w    46*4+2(a0),46*4+2(a1)
  303.     move.w    47*4+2(a0),47*4+2(a1)
  304.     move.w    48*4+2(a0),48*4+2(a1)
  305.     move.w    49*4+2(a0),49*4+2(a1)
  306.  
  307.     move.w    50*4+2(a0),50*4+2(a1)
  308.     move.w    51*4+2(a0),51*4+2(a1)
  309.     move.w    52*4+2(a0),52*4+2(a1)
  310.     move.w    53*4+2(a0),53*4+2(a1)
  311.     move.w    54*4+2(a0),54*4+2(a1)
  312.  
  313. copbuf.end
  314.     movem.l    (sp)+,d0-d7/a0-a6
  315.     rts
  316.  
  317.     ;goes back to the workbench
  318.     
  319. syson
  320.     movem.l    d0-d7/a0-a6,-(sp)
  321.  
  322.     move.w    #$0001,$dff09a        ;tbeint uit
  323.     move.l    intvbold,($6c).w
  324.     move.l    inttbeold,($64).w
  325.  
  326.     move.l    4,a6
  327.     jsr    -138(a6)        ;permit
  328.  
  329.     move.l    gfxlib,a6
  330.     jsr    -462(a6)        ;disownblitter
  331.  
  332.     move.l    wbview,a1
  333.     move.l    gfxlib,a6
  334.     jsr    _LVOLoadView(a6)     ; Fix view
  335.     jsr    _LVOWaitTOF(a6)
  336.     jsr    _LVOWaitTOF(a6)         ; wait for LoadView()
  337.  
  338. syson.ras
  339.     cmp.b    #$c0,$dff006        ;prevent copperjump
  340.     bne    syson.ras
  341.  
  342.     move.l    gfxlib,a6
  343.     move.l    gb_copinit(a6),$dff080     ; Kick it into life
  344.  
  345.     movem.l    (sp)+,d0-d7/a0-a6
  346.     rts
  347.     
  348.     ;goes back to the gadgetscreen
  349.     
  350. sysoff
  351.     movem.l    d0-d7/a0-a6,-(sp)
  352.      
  353.     move.l    gfxlib,a6
  354.     move.l    gb_ActiView(a6),wbview    ;current view
  355.     sub.l    a1,a1            ; clear a1
  356.     jsr     _LVOLoadView(a6)     ; Flush View to nothing
  357.     jsr    _LVOWaitTOF(a6)     ; Wait once
  358.     jsr    _LVOWaitTOF(a6)     ; Wait again.
  359.  
  360.     move.l    gfxlib,a6
  361.     jsr    -456(a6)        ;ownblitter
  362.  
  363.     move.l    4,a6
  364.     jsr    -132(a6)        ;forbid
  365.         
  366.     move.l    ($6c).w,intvbold
  367.     move.l    #intvb,($6c).w
  368.     move.l    ($64).w,inttbeold
  369.     move.l    #inttbe,($64).w
  370.     move.w    #$8001,$dff09a        ;tbeint aan
  371.     bsr    gracpr            ;reset copper
  372.     bsr    copbuf            ;copy copper
  373.     move.l    #cpr,$dff080
  374.  
  375.     movem.l    (sp)+,d0-d7/a0-a6
  376.     rts
  377.     
  378. cprsprrem
  379.     movem.l    d0-d7/a0-a6,-(sp)
  380.     lea    cprspr,a0
  381.     move.l    #sprdat,d0
  382.     move.w    #7,d1
  383. cprsprrem.a
  384.     move.w    d0,3*2(a0)
  385.     swap    d0
  386.     move.w    d0,1*2(a0)
  387.     swap    d0
  388.     add.l    #8,a0
  389.     dbra    d1,cprsprrem.a
  390.     movem.l    (sp)+,d0-d7/a0-a6
  391.     rts
  392.  
  393. varset                    ;variablen neerzetten
  394.     movem.l    d0-d7/a0-a6,-(sp)
  395.     move.l    #var,a0
  396.  
  397.     move.l    #cprbck,var_cprbck(a0)
  398.     move.l    gfxlib,var__GfxBase(a0)
  399.     move.b    ntscmode,var_ntsc(a0)
  400.  
  401.     move.l    curpic1,var_pic1(a0)    ;variabel
  402.     move.l    curpic2,var_pic2(a0)    ;variabel
  403.     move.w    anispd1,var_anispd1(a0)
  404.     move.w    anitel1,var_anitel1(a0)
  405.     movem.l    (sp)+,d0-d7/a0-a6
  406.     rts
  407.     
  408.     ;this routine handles all videotracker-routines
  409.  
  410. rotply    
  411.     movem.l    d0-d7/a0-a6,-(sp)
  412.  
  413.     moveq.l    #0,d0
  414.  
  415.     lea    currot1,a2        ;routine 1
  416.     move.w    rotinf1,d0        ;routine info
  417.     bsr.s    rotplyr
  418.  
  419. rotply.end
  420.     movem.l    (sp)+,d0-d7/a0-a6
  421.     rts
  422.  
  423.     ;this routine handles 1 routine, BLIT !
  424.     
  425. rotplyr
  426.     movem.l    d0-d7/a1-a6,-(sp)
  427.  
  428.     move.l    #rot,(a2)        ;routinestart address
  429.  
  430.     move.b    #50,ntscmode        ;ntsc/pal hz
  431.     clr.l    curpic2            ;background picture